﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;

namespace MineSweeperCheater.Test
{
  [TestFixture]
  class TestResizeCheatFieldDimensions
  {
    [Test]
    public void Rows0Cols0ByRows0Cols0()
    {
      var input = new Cheater.FieldDimensions() { Rows = 0, Cols = 0 };
      var result = Cheater.ResizeCheatFieldDimensions(input, 0, 0);

      Assert.That(result, Is.EqualTo(input));
    }

    [Test]
    public void Rows5Cols6ByRows0Cols0()
    {
      var input = new Cheater.FieldDimensions() { Rows = 0, Cols = 0 };
      var result = Cheater.ResizeCheatFieldDimensions(input, 0, 0);

      Assert.That(result, Is.EqualTo(input));
    }

    [Test]
    public void Rows5Cols6ByRows3Cols45()
    {
      var input = new Cheater.FieldDimensions() { Rows = 5, Cols = 6 };
      var result = Cheater.ResizeCheatFieldDimensions(input, 3, 45);
      var expected = new Cheater.FieldDimensions() { Rows = 8, Cols = 51 };

      Assert.That(result, Is.EqualTo(expected));
    }

    [Test]
    public void Rows5Cols6ByRowsMinus80ColsMinus3()
    {
      var input = new Cheater.FieldDimensions() { Rows = 5, Cols = 6 };
      var result = Cheater.ResizeCheatFieldDimensions(input, -80, -3);
      var expected = new Cheater.FieldDimensions() { Rows = -75, Cols = 3 };

      Assert.That(result, Is.EqualTo(expected));
    }

  }
}
